package subscription

import (
	"onvif_server/internal/model/field"
	"onvif_server/pkg/db"
)

type TestReq struct {
	ID    int    `json:"id" binding:"required"`
	Topic string `json:"topic" binding:"omitempty"`
}

type CreateReq struct {
	AppName string               `json:"app_name" binding:"required,max=100"`
	AppKey  string               `json:"app_key" binding:"required,max=100"`
	ApiUrl  string               `json:"api_url" binding:"required,max=500"`
	Topics  field.Slices[string] `json:"topics" binding:"required,min=1,unique,dive,min=1,max=100"`
	Remark  string               `json:"remark" binding:"omitempty,max=500"`
}

type UpdateReq struct {
	ID      int                  `json:"id" binding:"required"`
	AppName string               `json:"app_name" binding:"required,max=100"`
	AppKey  string               `json:"app_key" binding:"required,max=100"`
	ApiUrl  string               `json:"api_url" binding:"required,max=500"`
	Topics  field.Slices[string] `json:"topics" binding:"required,min=1,unique,dive,min=1,max=100"`
	Remark  string               `json:"remark" binding:"omitempty,max=500"`
}

func (f *UpdateReq) Fields() []string {
	return []string{"app_name", "app_key", "api_url", "topics", "remark"}
}

type DeleteReq struct {
	IDs []int `json:"ids" binding:"required"`
}

type Kv struct {
	Label string `json:"label"`
	Value string `json:"value"`
}
type ListReq struct {
	db.Paginator
}
